package com.hqyj.controller;


import com.hqyj.pojo.Storehouse;
import com.hqyj.service.IStorehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 仓库 前端控制器
 * </p>
 *
 * @author rock
 * @since 2021-10-21
 */
@RestController
@RequestMapping("/storehouse")
public class StorehouseController {

    //注入StoreHouseService
    @Autowired(required = false)
    IStorehouseService storehouseService;
    //加载库存页面
    @RequestMapping("/storehouseList")
    public HashMap<String,Object> storehouseList(Storehouse storehouse){
        return storehouseService.select(storehouse);
    }

    //新增
    @RequestMapping("/add")
    public HashMap<String ,Object> add(Storehouse storehouse){
        System.out.println(storehouse);
        return storehouseService.add(storehouse);
    }

    //修改
    @RequestMapping("/update")
    public HashMap<String ,Object> update(Storehouse storehouse){
        System.out.println(storehouse);
        return storehouseService.update(storehouse);
    }

    //删除
    @RequestMapping("/del")
    public HashMap<String ,Object> del(int storehouseId){
        System.out.println(storehouseId);
        return storehouseService.del(storehouseId);
    }
}

